/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/18 21:59
  *
  * @file       pd_adc_ch.h
  * @brief      Header file of Xxx hardware driver.
  *
  * @note       This file contains the Xxx object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/18     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_ADC_CH_H
#define JLC_SKY_ADC_CH_H

#include "stm32f407xx.h"
#include "pd_gpio.h"

struct ADCChannelVtbl;

/** @defgroup Object properties
  * @{
  */
typedef struct {
    GPIO *gpios;
    uint8_t gpioSize;

    uint32_t *ranks;
    uint8_t rankSize;

    uint32_t *channels;
    uint8_t chSize;

    // ADCChannel virtual table
    struct ADCChannelVtbl *vptr;
} ADCChannel;
/**
 * @}
 */

/** @defgroup Object virtual table definition
  * @{
  */
struct ADCChannelVtbl {
    void (*init)(const ADCChannel *this);
};
/**
 * @}
 */

/** @defgroup Object constructor and member function declaration
  * @{
  */
void ADCChannel_constructor(ADCChannel *this, GPIO *gpios, uint8_t gpioSize,
                            uint32_t *ranks, uint8_t rankSize,
                            uint32_t *channels, uint8_t chSize);
/**
 * @}
 */

/** @defgroup Object virtual table function implementation
  * @{
  */
static inline void ADCChannel_init(const ADCChannel *this) {
    this->vptr->init(this);
}
/**
 * @}
 */


#endif //JLC_SKY_ADC_CH_H
